<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Online CHAT</title>
<script language="javascript">
    
    var login_url="loginpage.html";
    
    var user_id="";
    
    var debug_msg = "";

	var message = "";
	
	var selected_user = ""
	
    //testing userlist array
    var userlistarray1 = new Array("user1","user2");
    
    //used to grab name from get
    function getParameterByName(name) {
    	name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    	var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
    	results = regex.exec(location.search);
    	return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
	}

    
    //this function will disconnect user from server and return to login page
    function disconnect(){
        //add disconnect from server code here
        
        //routes user back to login page
        location.href=login_url;
    }
    
    //this function will be used for when the refresh button is pressed
    function refreshUserList(){
    	//add in code to refresh user list.
    	var userlistarray2 = new Array("user3","user4");
    	userlist.updateUserList(userlistarray2);
    }
	
	function displaySelectedUser(){
		document.getElementById('selectedUser').innerHTML="Selected User is Currently "+ selected_user;
	}
	</script>
</head>
    <body bgcolor = 'lightblue'>
    <div align="center">
    	<h2><i>Welcome!! <script> document.write(getParameterByName("userName")) </script> </i></h2>
    </div>
    <p id="selectedUser">Selected User is Currently No One</p>
    <applet id="chatclient" Code="applet.ChatClientApplet.class" width=300 Height=400></applet>
    <script>    
    	//first filling of the userlist applet
    	chatclient.setUser(getParameterByName(userName));
    </script>
    </body>
</html>